"""
@file Senior.py
@author GalaktiK (jacobliu001@qq.com)
@date 2021-05-02

@copyright Copyright (c) 2021, Published under License GPLv2
"""

s = "".join([c for c in input() if c.isalnum()]) # Remove all non-alphanumeric characters
# basically, it iterates through the string and picks the alnum characters, puts them in a list, and
# run "".join().
# s.join() joins every string in the parameter using s as the separator.
# E.g. "x".join(['a','b','c','f']) evaluates to "axbxcxf"
# A special case is using an empty string to .join() an iterable of strings: It simply concatenates all the strings.
# This is incredibly useful and will come into use later in this program again.
chars = set(s) # gets the set of unique characters.
dic = dict() # maps the number of occurrences x ---> a list of chars list(ch)
for ch in chars: # iterate over every unique character
    x = s.count(ch) # count the number of occurences
    if not (x in dic.keys()):
        # As a dictionary is initialized with empty elements,
        # we need to first create a new list for a new key.
        # dic.keys() returns a list-like view of the keys that are present in the dictionary.
        dic[x] = list()
    # add the character to the list that corresponds to the number of occurences.
    dic[x].append(ch)

anss = [] # anss is a list that stores each of the individual 'blocks' in the answer.
cnt = 0 # cnt is a counter which is used for keeping track if it's an odd block or even block.
for x in sorted(dic.keys(), reverse=True): # Enumerate from large to small the number of occurences
    cnt += 1 # Update odd-even counter
    st = "".join(sorted(dic[x], reverse=bool(cnt % 2 == 0))) # Sort then concatenate, nothing interesting.
    anss.append(str(x)+st)
print(dic)
# s.join() is really a good thing...
print(",".join(anss))
